from torch import nn


class Encoder:
    def __init__(self):
        self.conv = nn.Sequential(
            nn.Linear(in_features=1, out_features=128),
            nn.Conv1d(in_channels=1, out_channels=32, kernel_size=3, padding=1),
            nn.ReLU(),
            nn.Conv1d(in_channels=32, out_channels=64, kernel_size=3, padding=1),
            nn.ReLU(),
            nn.Conv1d(in_channels=64, out_channels=1, kernel_size=3, padding=1),
            nn.ReLU()
        )
        self.fc = nn.Linear(in_features=1, out_features=128)
    def forward(self, x):
        x = self.conv(x.unsqueeze(1))
        return self.fc(x) + x